<?php 
require_once('steamxml.php');


if (isset($_POST['submit'])) {

$var_input_id = $_POST['inputid'];
	if (stristr($var_input_id,"765611")) {
		$var_output_id = $var_input_id;
		$var_profile_type = "profiles";
	} elseif (stristr($var_input_id,"STEAM_0")) {
		$var_output_id = GetFriendId($var_input_id);
		$var_profile_type = "profiles";
	} else{
		$var_output_id = $var_input_id;
		$var_profile_type = "id";
	}


$request_url = "http://www.steamcommunity.com/{$var_profile_type}/{$var_output_id}/?xml=1";
$xml = simplexml_load_file($request_url) or die("cannot read from steam");
$steamarray = array(
   'community_id'      => $xml->steamID64,
   'name'              => $xml->steamID,
   'status'            => $xml->onlineState,
   'action'            => $xml->stateMessage,
   'privacy'           => $xml->privacyState,
   'visibility'        => $xml->visibilityState,
   'avatar_icon'       => $xml->avatarIcon,
   'avatar_medium'     => $xml->avatarMedium,
   'avatar_full'       => $xml->avatarFull,
   'vac_banned'        => $xml->vacBanned,
   'custom_url'        => $xml->customURL,
   'registration_date' => $xml->memberSince,
   'rating'            => $xml->steamRating,
   'hours_played'      => $xml->hoursPlayed2Wk,
   'headline'          => $xml->headline,
   'location'          => $xml->location,
   'real_name'         => $xml->realname,
   'summary'           => $xml->summary,
 );

}


echo '<form action="'.$_SERVER[PHP_SELF].'" method="post" name="tehform" target="_self"><input name="inputid" type="text" /><input name="submit" type="submit" value="submit" /></form>';
echo "<br>";
echo "Profile type identifier: ".$var_profile_type;
echo "<br>";
echo "Url identifier: ".$var_output_id;
echo "<br>";
if (stristr($var_input_id,"765611")) {
$steamiddisplay = GetAuthID($var_input_id);
} elseif (stristr($var_input_id,"STEAM_")) {
$steamiddisplay = $var_input_id;
} else {
$steamiddisplay = GetAuthId($steamarray['community_id']);
}
echo "SteamID: ".$steamiddisplay;
echo "<br>";
echo "End.";


echo "<br>";
echo "<br>community_id / steamID64: ".$steamarray['community_id'];
echo "<br>name / steamID: ".$steamarray['name'];
echo "<br>status / onlineState: ".$steamarray['status'];
echo "<br>action / stateMessage: ".$steamarray['action'];
echo "<br>privacy / privacyState: ".$steamarray['privacy'];
echo "<br>visibility / visibilityState: ".$steamarray['visibility'];
echo "<br>avatar_icon / avatarIcon: <img src='".$steamarray['avatar_icon']."'/>";
echo "<br>avatar_medium / avatarMedium: <img src='".$steamarray['avatar_medium']."'/>";
echo "<br>avatar_full / avatarFull: <img src='".$steamarray['avatar_full']."'/>";
echo "<br>vac_banned / vacBanned: ".$steamarray['vac_banned'];
echo "<br>custom_url / customURL: ".$steamarray['custom_url'];
echo "<br>registration_date / memberSince: ".$steamarray['registration_date'];
echo "<br>rating / steamRating: ".$steamarray['rating'];
echo "<br>hours_played / hoursPlayed2Wk: ".$steamarray['hours_played'];
echo "<br>headline / headline: ".$steamarray['headline'];
echo "<br>location / location: ".$steamarray['location'];
echo "<br>real_name / realname: ".$steamarray['real_name'];
echo "<br>summary / summary: ".$steamarray['summary'];
?>